package com.zenchn.dao;

import com.zenchn.entity.ReportStatisticsVO;
import com.zenchn.generic.GenericDao;
import com.zenchn.model.TMiCustomer;
import com.zenchn.model.TMiCustomerExample;

import java.time.LocalDateTime;
import java.util.List;

import org.apache.ibatis.annotations.Param;

public interface TMiCustomerMapper extends GenericDao<TMiCustomer, String, TMiCustomerExample> {
    long countByExample(TMiCustomerExample example);

    int deleteByExample(TMiCustomerExample example);

    int deleteByPrimaryKey(String customerId);

    int insert(TMiCustomer record);

    int insertSelective(TMiCustomer record);

    List<TMiCustomer> selectByExample(TMiCustomerExample example);

    TMiCustomer selectByPrimaryKey(String customerId);

    int updateByExampleSelective(@Param("record") TMiCustomer record, @Param("example") TMiCustomerExample example);

    int updateByExample(@Param("record") TMiCustomer record, @Param("example") TMiCustomerExample example);

    int updateByPrimaryKeySelective(TMiCustomer record);

    int updateByPrimaryKey(TMiCustomer record);

    /**
     * 获取本期新增客户数量
     *
     * @param areasCodeList
     * @param areasCode
     * @param accountId
     * @param customerType
     * @param startDate
     * @param endDate
     * @return
     */
    List<ReportStatisticsVO> selectCurCustomerNum(@Param("areasCodeList") List<String> areasCodeList, @Param("areasCode") String areasCode, @Param("accountId") String accountId, @Param("customerType") String customerType, @Param("startDate") LocalDateTime startDate, @Param("endDate") LocalDateTime endDate);

    /**
     * 获取期末客户等级分布
     *
     * @param areasCodeList
     * @param areasCode
     * @param accountId
     * @param customerType
     * @param endDate
     * @return
     */
    List<ReportStatisticsVO> selectFinalCustomerLevelNum(@Param("areasCodeList") List<String> areasCodeList, @Param("areasCode") String areasCode, @Param("accountId") String accountId, @Param("customerType") String customerType, @Param("endDate") LocalDateTime endDate);

    /**
     * 获取期末客户总数
     *
     * @param areasCodeList
     * @param areasCode
     * @param accountId
     * @param customerType
     * @param endDate
     * @return
     */
    List<ReportStatisticsVO> selectFinalCustomerAllNum(@Param("areasCodeList") List<String> areasCodeList, @Param("areasCode") String areasCode, @Param("accountId") String accountId, @Param("customerType") String customerType, @Param("endDate") LocalDateTime endDate);


    /**
     * 最新客户等级分布
     *
     * @param areasCodeList
     * @param areasCode
     * @param accountId
     * @param customerType
     * @return
     */
    List<ReportStatisticsVO> selectNewCustomerLevelNum(@Param("areasCodeList") List<String> areasCodeList, @Param("areasCode") String areasCode, @Param("accountId") String accountId, @Param("customerType") String customerType);

    /**
     * 本期晋级数量
     *
     * @param areasCodeList
     * @param areasCode
     * @param accountId
     * @param customerType
     * @param startDate
     * @param endDate
     * @return
     */
    List<ReportStatisticsVO> selectCurCustomerUpgradeNum(@Param("areasCodeList") List<String> areasCodeList, @Param("areasCode") String areasCode, @Param("accountId") String accountId, @Param("customerType") String customerType, @Param("startDate") LocalDateTime startDate, @Param("endDate") LocalDateTime endDate);

    /**
     * 本期业绩完成情况
     *
     * @param areasCodeList
     * @param areasCode
     * @param accountId
     * @param customerType
     * @param startDate
     * @param endDate
     * @return
     */
    List<ReportStatisticsVO> selectCurCustomerFinishNum(@Param("areasCodeList") List<String> areasCodeList, @Param("areasCode") String areasCode, @Param("accountId") String accountId, @Param("customerType") String customerType, @Param("startDate") LocalDateTime startDate, @Param("endDate") LocalDateTime endDate);

}